home *** CD-ROM | disk | FTP | other *** search
- Path: news.compuserve.com!newsmaster
- From: <.,@compuserve.com>
- Newsgroups: comp.lang.c++,comp.object,comp.object.logic
- Subject: polymorphism
- Date: 24 Mar 1996 04:46:03 GMT
- Organization: CompuServe Incorporated
- Message-ID: <4j2k2b$4pj@arl-news-svc-3.compuserve.com>
- NNTP-Posting-Host: ad28-178.compuserve.com
- Content-Type: text/plain
- Content-length: 629
- X-Newsreader: AIR Mosaic (16-bit) version 4.00.08.32
-
-
- >>What is polymorphism.
-
- The usual example is a shape object.
- Shape is your base class.
- From this you derive the classes called Circle, Triangle, and Square.
- Shape has a function called Draw()
- So each of the 3 classes (Circle, Triangle, Square) redo the Draw() function
- in there own way. Thus they all will be drawn differently from the others.
- The compiler can handle this. The classes are said to be able
- to draw themselves.
- Note the Draw() must be identicle to the Shape classes Draw().
- You can't change the argument list, this would be an overloaded
- function and would not be the same function.
-
-